#include <iostream>
#include <unistd.h>
#include <memory>
#include "HttpServer.hpp"
using namespace wxd;
void Login(HttpRequest &request, HttpResponse &response)
{
    LOG(LogLevel::DEBUG) << "进入登录模块";
    response.Build(request);
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cerr << "usage: " << argv[0] << " port" << std::endl;
        exit(USAGE_ERR);
    }
    uint16_t port = std::stoi(argv[1]);
    std::unique_ptr<HttpServer> http_server_ptr = std::make_unique<HttpServer>(port);

    // 注册方法
    http_server_ptr->Register("/login", Login);
    http_server_ptr->Start();
    return 0;
}